758d72aee461b00cb7a6d6f70497a0932cb541be,portal-impl/src/com/liferay/portlet/trash/util/TrashImpl.java,TrashImpl,getViewContentURL,#String#number#ThemeDisplay#,266
Before Change
String urlViewContent = null;
if (trashRenderer != null) {
TrashEntry trashEntry = TrashEntryLocalServiceUtil.getEntry(
className, classPK);
String namespace = PortalUtil.getPortletNamespace(
PortletKeys.TRASH);
urlViewContent = PortalUtil.getControlPanelFullURL(
themeDisplay.getScopeGroupId(), PortletKeys.TRASH, null);
urlViewContent = HttpUtil.addParameter(
urlViewContent, namespace + "struts_action",
"/trash/view_content");
urlViewContent = HttpUtil.addParameter(
urlViewContent, namespace + "redirect",
themeDisplay.getURLCurrent());
if (trashEntry.getRootEntry() != null) {
urlViewContent = HttpUtil.addParameter(
urlViewContent, namespace + "className", className);
urlViewContent = HttpUtil.addParameter(
urlViewContent, namespace + "classPK",
String.valueOf(classPK));
}
else {
urlViewContent = HttpUtil.addParameter(
urlViewContent, namespace + "trashEntryId",
String.valueOf(trashEntry.getEntryId()));
}
urlViewContent = HttpUtil.addParameter(
urlViewContent, namespace + "type", trashRenderer.getType());
urlViewContent = HttpUtil.addParameter(
urlViewContent, namespace + "showActions",
Boolean.FALSE.toString());
urlViewContent = HttpUtil.addParameter(
urlViewContent, namespace + "showAssetMetadata",
Boolean.TRUE.toString());
urlViewContent = HttpUtil.addParameter(
urlViewContent, namespace + "showEditURL",
Boolean.FALSE.toString());
}
return urlViewContent;
After Change
if (!themeDisplay.isSignedIn() ||
!isTrashEnabled(themeDisplay.getScopeGroupId()) ||
!PortletPermissionUtil.hasControlPanelAccessPermission(
themeDisplay.getPermissionChecker(),
themeDisplay.getScopeGroupId(), PortletKeys.TRASH)) {
return null;
}
TrashHandler trashHandler = TrashHandlerRegistryUtil.getTrashHandler(
className);
if (trashHandler.isInTrashContainer(classPK)) {
ContainerModel containerModel = trashHandler.getTrashContainer(
classPK);
classPK = containerModel.getContainerModelId();
className = containerModel.getModelClassName();
trashHandler = TrashHandlerRegistryUtil.getTrashHandler(className);
}
TrashRenderer trashRenderer = trashHandler.getTrashRenderer(classPK);
if (trashRenderer == null) {
return null;
}
TrashEntry trashEntry = TrashEntryLocalServiceUtil.getEntry(
className, classPK);
String namespace = PortalUtil.getPortletNamespace(PortletKeys.TRASH);
Map<String, String[]> params = new HashMap<String, String[]>();
params.put(
namespace + "struts_action", new String[]{"/trash/view_content"});
params.put(
namespace + "redirect", new String[]{themeDisplay.getURLCurrent()});
if (trashEntry.getRootEntry() != null) {
params.put(namespace + "className", new String[]{className});
params.put(
namespace + "classPK", new String[]{String.valueOf(classPK)});
}
else {
params.put(
namespace + "trashEntryId",
new String[]{String.valueOf(trashEntry.getEntryId())});
}
params.put(namespace + "type", new String[]{trashRenderer.getType()});
params.put(
namespace + "showActions", new String[]{Boolean.FALSE.toString()});
params.put(
namespace + "showAssetMetadata",
new String[]{Boolean.TRUE.toString()});
params.put(
namespace + "showEditURL", new String[]{Boolean.FALSE.toString()});
return PortalUtil.getControlPanelFullURL(
themeDisplay.getScopeGroupId(), PortletKeys.TRASH, params);